﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace pb_ws_client
{
    public partial class Reply : Form
    {
        string _pid;
        PostServiceReference.PostServiceSoapClient psr;
        string _title;

        public Reply(string pid, string ptitle)
        {
            InitializeComponent();
            psr = new PostServiceReference.PostServiceSoapClient();
            _pid = pid;
            _title = ptitle;
        }

        private void Reply_Load(object sender, EventArgs e)
        {
            refreshData();
        }

        public void refreshData()
        {
            LogicLayer.dt_reply = psr.GetUnexReplyList(LogicLayer.SID, _pid);
            dgv_Reply.DataSource = LogicLayer.dt_reply;
        }
        
        private void dgv_Reply_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow pr = dgv_Reply.CurrentRow;
            string pid = pr.Cells[0].Value.ToString();
            ReplyExam pe = new ReplyExam(pid, psr, this, _title);
            pe.Show();
        }

        private void btn_Detail_Click(object sender, EventArgs e)
        {
            DataGridViewRow pr = dgv_Reply.SelectedRows[0];
            string pid = pr.Cells[0].Value.ToString();
            ReplyExam pe = new ReplyExam(pid, psr, this, _title);
            pe.Show();
        }
    }
}
